@extends('layouts.default')
@section('content')
	<div class="items-filter">
			<div class="heading">Filtros</div>
			<div class="fields">
				<div class="reference">
					<label class="label">Referencia: </label><input type="text" />
				</div>
				<div class="name">
					<label class="label">Nombre: </label><input type="text" />
				</div>
				<div class="price-from">
					<label class="label">Precio desde: </label><input type="text"/>
				</div>
				<div class="price-to">
					<label class="label">Precio hasta: </label><input type="text"/>
				</div>
				<div class="controls">
					<a href="#">Buscar</a>
				</div>
			</div>
	</div>

	@if($items->isEmpty())
	<p>No hay items para mostrar.</p>
	@else
	<table class="table" id="items-table">
		<thead>
			<tr>
				<th>Referencia</th>
				<th>Nombre</th>
				<th>Cantidad</th>
				<th>Precio</th>
				<th colspan="3">Acciones</th>
			</tr>
		</thead>
		<tbody>
	     @foreach($items as $item)
	     	<tr id="{{$item->pk}}">
	     		<td>{{$item->reference}}</td>
	     		<td>{{$item->name}}</td>
	     		<td>{{$item->amount}}</td>
	     		<td>{{$item->formattedPrice()}}</td>
	     		<td><a class="btn more" href="#">Más</a></td>
	     		<td><a class="btn edit" href="#">Editar</a></td>
	     		<td><a class="btn delete" href="#">Borrar</a></td>
	     	</tr>
	     @endforeach
     	</tbody>
     </table>
     {{$items->links()}}
     @endif

     <div class="item-options">
     	<a href="#" class="btn create">Agregar nuevo item</a>
     </div>

    @if(!$trash->isEmpty())
    <div>Items eliminados incluídos en solicitudes</div>
	<table class="table" id="items-trash-table">
		<thead>
			<tr>
				<th>Referencia</th>
				<th>Nombre</th>
				<th>Cantidad</th>
				<th>Precio</th>
				<th colspan="2">Acciones</th>
			</tr>
		</thead>
		<tbody>
	     @foreach($trash as $item)
	     	<tr id="{{$item->pk}}">
	     		<td>{{$item->reference}}</td>
	     		<td>{{$item->name}}</td>
	     		<td>{{$item->amount}}</td>
	     		<td>{{$item->formattedPrice()}}</td>
	     		<td><a class="btn more" href="#">Más</a></td>
	     		<td><a class="btn restore" href="#">Restaurar</a></td>
	     	<tr>
	     @endforeach
     	</tbody>
     </table>
     {{$trash->links()}}
     @endif

     
     {{ HTML::style('css/popup.css'); }}
     <script type="text/javascript" src="js/Items.js"></script>
@stop